package com.mooneros.study.designpattern.strategy;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * 策略模式
 * @author mac
 */
@Service
public class TestStrategyService {

    @Resource
    private IStudyService studyChineseService;

    @Resource
    private IStudyService studyEnglishService;

    @Resource
    private IStudyService studyMathService;

    public void handleRequest(String studyType) {
        // 旧逻辑
        // oldIfJuage(studyType);
        // 策略模式
        strageMode(studyType);
    }

    private void oldIfJuage(String studyType) {
        if("chinese".equals(studyType)) {
            studyChineseService.doStudy(studyType);
        } else if("english".equals(studyType)) {
            studyEnglishService.doStudy(studyType);
        } else if("math".equals(studyType)) {
            studyMathService.doStudy(studyType);
        }
    }

    /**
     * 策略模式
     */
    private void strageMode(String studyType) {
//        for(IStudyService studyService : ) {
//
//        }
    }



}
